<template>
  <div class="deposit_mod" :class="themeClass">
    <v-loading v-if="loading" />
    <v-nav :title="$t('Deposit.Recharge')" v-if="isDayTime === false" title_color="#fff" :class="themeClass">
      <a @click="$router.push('/asset/rechargedetails')" :class="bgColor">{{ $t('Deposit.Recharge details') }}</a>
    </v-nav>
    <v-nav :title="$t('Deposit.Recharge')" v-if="isDayTime === true">
      <a @click="$router.push('/asset/rechargedetails')">{{ $t('Deposit.Recharge details') }}</a>
    </v-nav>
    <div class="deposit_mod_box">
      <div class="deposit_mod_box_currency" v-for="(item, index) in depositList" :key="index">
        <router-link :to="`/asset/deposit/detail/${item.id}`" class="custom_cell" :class="themeClass1">
          <div style="display: flex">
            <img :src="item.logo_link" alt="" />
            <span class="custom-title" :class="bgColor">{{ item.currency }}({{ item.currency_network }})</span>
          </div>
          <van-icon name="arrow" />
        </router-link>
      </div>

      <div class="deposit_mod_box_remark">
        <div>
          <p>1.</p>
          <p>{{ $t('Deposit.info1') }}</p>
        </div>
        <div>
          <p>2.</p>
          <p>{{ $t('Deposit.info2') }}</p>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'Deposit',
  data() {
    return {
      depositList: [],
      isDayTime: false,
      loading: false
    }
  },
  computed: {
    themeClass() {
      return this.isDayTime ? '' : 'darknight'
    },
    bgColor() {
      return this.isDayTime ? 'black' : 'white'
    },
    themeClass1() {
      return this.isDayTime ? '' : 'dark_li_color'
    }
  },
  watch: {
    '$store.state.nightMode': {
      handler(newVal) {
        this.isDayTime = newVal
      },
      immediate: true
    }
  },
  activated() {
    this.getRechargeList()
  },
  methods: {
    async getRechargeList() {
      this.loading = true
      await this.$https.post('/platform/getRechargeList').then(res => {
        this.depositList = res.data
      })
      this.loading = false
    }
  }
}
</script>

<style lang="less" scoped>
@import url('./index.less');
</style>
